<template>
	<div id="article-deatil">
		<md-editor
		    v-model="content"
		    previewOnly
		  />
	</div>
</template>

<script>
	 import MdEditor from 'md-editor-v3';
	 import 'md-editor-v3/lib/style.css';
	export default{
		data(){
			return {
				content:''
			}
		},
		created() {
			this.$get('article/getArticleById',{id:this.id}).then(res=>{
				if(res.code==200){
					this.content=res.data.content
				}else{
					this.$msgError(res)
				}
			})
		},
		computed:{
			id(){
				return this.$route.params.id
			}
		},
		components:{
			MdEditor
		},
		beforeCreate() {
			//启用App.vue滚动条
			document.documentElement.setAttribute('auto-stream', '')
			this.$store.commit('set_needAppScrollbar', true)
		},
		beforeUnmount() {
			//关闭App.vue滚动条
			document.documentElement.removeAttribute('auto-stream')
			this.$store.commit('set_needAppScrollbar', false)
		}
	}
</script>

<style lang="scss">
	#article-deatil{
		max-width: 1000px;
		margin: 0 auto;
	}
</style>
